// https://nuxt.com/docs/api/configuration/nuxt-config
const proxyPrefix = process.env.VITE_APP_PROXY_PREFIX
const tokenPrefix =  process.env.VITE_APP_TOKEN_PREFIX
export default defineNuxtConfig({
  compatibilityDate: '2024-11-01',
  devServer: {
    port: parseInt(process.env.VITE_APP_PORT as string, 10),
    host: '0.0.0.0',
  },
  css: ['./style/skin.less', './style/index.css', './style/global.less'],
  alias: {
    "@cps": "/components",
    'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js',
  },
  runtimeConfig:{
    public:{
      VITE_APP_TOKEN_PREFIX: tokenPrefix,
      VITE_APP_PROXY_PREFIX: proxyPrefix
    }
  },
  ssr: false,
  devtools: {enabled: true},
  modules: [
    "nuxt-lodash",
    "dayjs-nuxt",
    "nuxt-echarts",
    "nuxt-monaco-editor",
    "@pinia/nuxt",
    "@nuxtjs/tailwindcss",
  ],
  dayjs: {
    defaultLocale: 'zh-cn',
    plugins: ['relativeTime'],
  },
  vite: {
    server: {
      proxy: {
        '/dev': {
          target: 'http://47.115.39.103:9501',
          changeOrigin: true,
          ws: true,
          toProxy: true,
          rewrite: path => path.replace('/dev', ''),
        }
      }
    }
  }
})